import pytest

# 多重断言：单个测试中可以执行多个断言
# 不会中断：即使断言失败也会继续执行
# 完整报告：最终会显示所有失败的断言
from pytest_assume.plugin import assume
from common.request import Requests
from common.db import db
from common.login import Login
from common.header.Header import Headers
from common.backup_roll import db_backup_reset
class TestCase:

    # def test_list(self,test_setup_teardown):
    #     login = Login()
    #     login.login("这是权限管理列表")
    #     header = Headers().headers()
    #
    #     res = Requests(headers=header).get_request(url="/boss/pms/permission/list")
    #     print(res.text)
    #     assume(res.status_code == 200)
    #     db_conn=test_setup_teardown
    #     db_conn.query("SELECT permission_name FROM pms_permission WHERE permission_name = '西昌侯'")
    #     # data = a
    #     # result = data[0][0]
    #     # assume(result in res.text)





    # def test_add(self):
    #     login = Login()
    #     login.login("用户添加")
    #     header = Headers().headers()
    #     res = Requests(headers=header).get_request(url="/boss/pms/permission/list")
    #     print(res.text)
    #     assume(res.status_code == 200)
    #     db_conn=test_setup_teardown
    #     a = db_conn.query("SELECT permission_name FROM pms_permission WHERE permission_name = '西昌侯'")
    #     data = a
    #     result = data[0][0]
    #     assume(result in res.text)







    def test_list2(self):
        login = Login()
        login.login("这是添加权限")
        header = Headers().headers()
        print(header)
        data={"permissionName":"西门庆","permission":"西门庆","remark":"西门庆"}
        res = Requests(headers=header).post_request(url="/boss/pms/permission/add",data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)
# import pytest
# from django.contrib.auth import login
# # 多重断言：单个测试中可以执行多个断言
# # 不会中断：即使断言失败也会继续执行
# # 完整报告：最终会显示所有失败的断言
# from pytest_assume.plugin import assume
# from common.request import Requests
# from common.db import db
# from common.login import Login
# from common.header.Header import Headers
# from common.backup_roll import db_backup_reset
# class TestCase:
#
#     # def test_list(self,test_setup_teardown):
#     #     login = Login()
#     #     login.login("这是权限管理列表")
#     #     header = Headers().headers()
#     #
#     #     res = Requests(headers=header).get_request(url="/boss/pms/permission/list")
#     #     print(res.text)
#     #     assume(res.status_code == 200)
#     #     db_conn=test_setup_teardown
#     #     db_conn.query("SELECT permission_name FROM pms_permission WHERE permission_name = '西昌侯'")
#     #     # data = a
#     #     # result = data[0][0]
#     #     # assume(result in res.text)
#
#
#
#
#
#     def test_add(self):
#         login = Login()
#         login.login("用户添加")
#         header = Headers().headers()
#         res = Requests(headers=header).get_request(url="/boss/pms/permission/list")
#         print(res.text)
#         assume(res.status_code == 200)
#         # db_conn=test_setup_teardown
#         # a = db_conn.query("SELECT permission_name FROM pms_permission WHERE permission_name = '西昌侯'")
#         # data = a
#         # result = data[0][0]
#         # assume(result in res.text)
#
#
#
#
#
#
#
#     def test_list2(self):
#         login = Login()
#         login.login("这是添加权限")
#         header = Headers().headers()
#         print(header)
#         data={"permissionName":"西门庆","permission":"西门庆","remark":"西门庆"}
#         res = Requests(headers=header).post_request(url="/boss/pms/permission/add",data=data)
#         print(res.text)
#         print(res.url)
#         print(res.cookies)
